package com.aerozhonghuan.logisticsmall.modules.order.adapter;

import android.app.Activity;
import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.aerozhonghuan.logisticsmall.framework.base.TitlebarActivity;
import com.aerozhonghuan.logisticsmall.framework.base.TitlebarFragment;

import java.util.List;

/**
 * 描述
 *
 * @author zhangyonghui
 * 创建日期 2019-05-24
 */
public class MyOrdersViewPagerAdapter extends FragmentPagerAdapter {

    private String[] tabNames;
    private TitlebarActivity context;
    private List<TitlebarFragment> orderFragments;

    public MyOrdersViewPagerAdapter(TitlebarActivity context, List<TitlebarFragment> orderFragments, String[] tabNames) {
        super(context.getSupportFragmentManager());
        this.context = context;
        this.orderFragments = orderFragments;
        this.tabNames = tabNames;
    }

    @Override
    public Fragment getItem(int position) {
        return orderFragments.get(position);
    }

    @Override
    public int getCount() {
        return orderFragments.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return tabNames[position];
    }
}
